"use strict";
exports.__esModule = true;
var electron_1 = require("electron");
var api = {
    send: function (message) {
        electron_1.ipcRenderer.send("message", message);
    },
    /**
     * Here you can expose functions to the renderer process
     * so they can interact with the main (electron) side
     * without security problems.
     *
     * The function below can accessed using `window.Main.sayHello`
     */
    sendMessage: function (message) {
        electron_1.ipcRenderer.send("message", message);
    },
    /**
      Here function for AppBar
     */
    Minimize: function () {
        electron_1.ipcRenderer.send("minimize");
    },
    Maximize: function () {
        electron_1.ipcRenderer.send("maximize");
    },
    Close: function () {
        electron_1.ipcRenderer.send("close");
    },
    /**
     * Provide an easier way to listen to events
     */
    on: function (channel, callback) {
        electron_1.ipcRenderer.on(channel, function (_, data) { return callback(data); });
    },
    getStocks: function () {
        return electron_1.ipcRenderer.sendSync("getStocks");
    },
    hideMainWindow: function () {
        electron_1.ipcRenderer.send("hideMainWindow");
    },
    addStock: function (stockCode) {
        return electron_1.ipcRenderer.sendSync("addStock", stockCode);
    },
    delStock: function (stockCode) {
        return electron_1.ipcRenderer.sendSync("delStock", stockCode);
    },
    closeAddStockWindow: function () {
        electron_1.ipcRenderer.send("closeAddStockWindow");
    }
};
electron_1.contextBridge.exposeInMainWorld("Main", api);
/**
 * Using the ipcRenderer directly in the browser through the contextBridge ist not really secure.
 * I advise using the Main/api way !!
 */
electron_1.contextBridge.exposeInMainWorld("ipcRenderer", electron_1.ipcRenderer);
